package com.zhoumy.processor;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

/**
 * @author xf
 * @description BeanPostProcessor的实现类
 * @date 2019/5/22 14:06
 */
public class InitialBeanPostProcessor implements BeanPostProcessor {

    public InitialBeanPostProcessor() {
        System.out.println("第4步：这是BeanPostProcessor实现类(InitialBeanPostProcessor)的构造器！！");
    }

    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("第14步：postProcessBeforeInitialization(BeanPostProcessor接口实现类InitialBeanPostProcessor的方法)对属性进行更改, bean = " + bean.getClass());
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("第18步：postProcessAfterInitialization(BeanPostProcessor接口的方法)对属性进行更改, bean = " + bean.getClass());
        return bean;
    }
}